﻿// <copyright file="SequenceTests.cs" company="Fluent.NET">
// Microsoft Public License (Ms-PL)
// </copyright>
// <author>Chris Eargle</author>
// <email>kodefuguru@live.com</email>
// <date>2009-12-09</date>
// <summary>Factory class tests</summary>
namespace Fluent.Tests
{
    using System;
    using System.Linq;
    using Fluent;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    /// <summary>
    /// Contains tests for Sequence
    /// </summary>
    [TestClass]
    public class SequenceTests
    {
        /// <summary>
        /// Tests the creation of an empty IEnumerable<typeparamref name="T"/> from the factory
        /// </summary>
        [TestMethod]
        public void Empty()
        {
            var x = Sequence.Create<int>(0, i => i);            
            Assert.IsFalse(x.Any());
        }

        /// <summary>
        /// Tests the creation of an non-empty IEnumerable<typeparamref name="T"/> from the factory.
        /// </summary>
        [TestMethod]
        public void Nonempty()
        {
            var x = Sequence.Create<int>(1, i => i);
            Assert.IsTrue(x.Any());
        }

        /// <summary>
        /// Makes sure the proper number of elements are returned from the factory
        /// </summary>
        [TestMethod]
        public void Elements()
        {
            var x = Sequence.Create(20, i => i + 1);
            Assert.AreEqual(x.Count(), 20);
        }
    }
}
